package com.netx.data;
import java.sql.SQLException;


public abstract class DatabaseException extends Exception {

	private final Connection _connection;
	private final String _query;

	DatabaseException(Connection c, SQLException sqle, String q) {
		super(sqle.getMessage(), sqle);
		_connection = c;
		_query = q;
	}

	// for RestrictionException
	DatabaseException(Connection c, String q, String msg) {
		super(msg);
		_connection = c;
		_query = q;
	}

	public Connection getConnection() {
		return _connection;
	}
	
	public SQLException getSQLCause() {
		return (SQLException)getCause();
	}
	
	public String getQuery() {
		return _query;
	}
}
